Method for reordering the records of a file

ABSTRACT

THERE IS DESCRIBEDC HEREIN A METHOD FOR THE REORDERING OF A FILE WHEREBY, AFTER SUCH REORDERING, THE RECORDS CONSTITUTING THE FILE ARE ARRANGED SUCH THAT THE ORDER OF THEIR KEY VALUES IS BIASED IN A SEQUENTIAL DIRECTION. THE FILE IS THUS ADVANTAGEOUSLY PRECONDITIONED FOR BEING SORTED, PARTICULARLY BY A DISTRIBUTION SORT TECHNIQUE. THE METHOD FIRST ENTAILS THE PERFORMING OF AN INTERNAL SORT BY REPLACEMENT SELECTION ON THE FILE TO PROVIDE A PLURALITY OF STRINGS OF RECORDS, THE RECORDS CONSTITUTING THE RESPECTIVE STRINGS BEING IN ORDERED SEQUENCES, THE STRINGS BEING CONSECUTIVELY NUMBERED AS THEY ARE CREATED IN THE INTERNAL SORT, VIZ., FIRST TO MTH STRINGS. IF DESIRED, THE RECORDS IN THE STRINGS CAN BE BLOCKED, I.E., EACH BLOCK CONTAINING 1, 2, . . . , K RECORDS AS DESIRED. THE RECORDS ARE THEN WRITTEN ONTO A &#34;DIRECT ACCESS&#34; STORAGE DEVICE SUCH AS A DISK OR A DRUM IN A MANNER WHEREBY THE FIRST BLOCK OF THE FIRST STRING IS PLACED ON THE FIRST SECTOR OF THE FIRST TRACK OF THE STORAGE, THE SECOND BLOCK OF THE FIRST STRING IS PLACED ON THE SECOND SECTOR OF THE FIRST TRACT, ETC., THE FIRST BLOCK OF THE SECOND STRING IS PLACED ON THE SECOND SECTOR OF THE SECOND TRACK, THE FIRST BLOCK OF THE THIRD STRING IS PLACED ON THE THIRD SECTOR OF THE THIRD TRACK, ET SEQ. THUS, IF BIJ REPRESENTS THE JTH BLOCK OF THE ITH STRING, THEN THE BLOCKS ARE WRITTEN ONTO THE STORAGE DEVICE AS FOLLOWS:   SECTORS TRACKS 1 2 3 N 1 B11 B12 B13 . . . B1N 2 B21 B22 . . . B2, N-1 3 B31 . . . B3 N-2 . . . . . . M BM1 . . . BM, N-M+1 . . . WITH THE RECORDS SO ARRANGED ON THE DIRECT ACCESS STORAGE DEVICE, THEY ARE READ DIAGONALLY THEREFROM, I.E., THE FIRST BLOCK OF THE FIRST STRING FOLLOWED BY THE FIRST BLOCK OF THE SECOND STRING ET SEQ., THEN THE SECOND BLOCK OF THE FIRST STRING FOLLOWED BY THE SECOND BLOCK OF THE SECOND STRING, ET SEQ., TO PRODUCE A FILE HAVING THE ORDER B11, B21, . . . . BML, B12, B22, . . . BM2, . . . , BM3, . . . , BMN WITH THE PLACING OF THE BLOCKS ON THE &#34;DIRECT ACCESS&#34; STORAGE DEVICE IN THIS MANNER, THE ARRANGEMENT IS EFFECTED WHEREBY THE BEGINNING OF THE NEXT BLOCK TO BE READ/WRITTEN IS ROTATIONALLY ADJACENT TO THE END OF THE LAST BLOCK WHICH WAS READ/WRITTEN WHEREBY LATENCY AND SEEK TIME ARE SIGNIFICANTLY MINIMIZED. THE RECORDERING OF THE FILE PRODUCED FROM THE READING OUT OF THE BLOCKS IN THE DIAGONAL MANNER AS DESCRIBED HEREINABOVE CAN NOW BE ADVANTAGEOUSLY UTILIZED IN A DISTRIBUTION SORT, SUCH AS OF THE TAG OR RECORD TYPES.

DEFENSIVE PUBLICATION UNITED STATES PATENT OFFICE Published at the request of the applicant or owner in accordance with the Notice of Dec. 16, 1969, 869 0.6. 687. The abstracts of Defensive Publication applications are identified by distinctly numbered series and are arranged chronologically. The heading of each abstract indicates the number of pages of specification, including claims and sheets of drawings contained in the application as originally filed. The files of these applications are available to the public for inspection and reproduction may be purchased for 30 cents a sheet.

Defensive Publication applications have not been examined as to the merits of alleged invention. The Patent Ofiice makes no assertion as to the novelty of the disclosed subject matter.

PUBLISHED JULY 10, 1973 T912,008 METHOD FOR REORDERING THE RECORDS OF A FILE Brian T. Bennett, Mohegan Lake, and Archie C. McKellar, Mount Kisco, N.Y., assignors to International Business Machines Corporation, Armonk, NY.

Filed Dec. 26, 1972, Ser. No. 318,335 Int. Cl. G06f 7/24 US. Cl. 444-1 6 Sheets Drawing. 40 Pages Specification CYLINDER NUMBER TRACK NUMBER QU-5USN- There is described herein a method for the reordering of a file whereby, after such reordering, the records constituting the file are arranged such that the order of their key values is biased in a sequential direction. The file is thus advantageously preconditioned for being sorted, particularly by a distribution sort technique. The method first entails the performing of an internal sort by replacement selection on the file to provide a plurality of strings of records, the records constituting the respective strings being in ordered sequences, the strings being consecutively numbered as they are created in the internal sort, viz., first to mth strings. If desired, the records in the strings can be blocked, i.e., each block containing 1, 2, k records as desired. The records are then written onto a direct access storage device such as a disk or a drum in a manner whereby the first block of the first string is placed on the first sector of the first track of the storage, the second block of the first string is Placed on the second sector of the first track, etc., the first block of the second string is placed on the second sector of the second track, the first block of the third string is placed on the third sector of the third track, et seq. Thus, if B represents the jth block of the ith string, then the blocks are written onto the storage device as follows:

Sectors Tracks 1 2 3 n 1 B11 B 2 B13 B1 1 c 2 B 1 B22 B -1 3 B31 B3, n-fl m B Bm, n-m+1 With the records so arranged on the direct access storage device, they are read diagonally therefrom, i.e., the first block of the first string followed by the first block of the second string et seq., then the second block of the first string followed by the second block of the second string, et seq., to produce a file having the order With the placing of the blocks on the direct access storage device in this manner, the arrangement is effected whereby the beginning of the next block to be read/written is rotationally adjacent to the end of the last block which was read/written whereby latency and seek time are significantly minimized. The reordering of the file produced from the reading out of the blocks in the diagonal manner as described hereinabove can now be advantageously utilized in a distribution sort, such as of the tag or record types.

- 2 ull: 12 22, I

July 10, 1973 a. T. BENNETT ETAL T912,008

METHOD FOR REORDERING THE RECORDS OF A FILE Filed Dec. 26, 1972 v 6 Sheets-Sheet 1 g FIG. 1 INPUT FILE i [2 I 22] 1 [2?]1 lsolszf a [zahshelzslzei 5 l4 lnlmlzohsle [24] s {25]2 [18115 [31110129] 9111M FIG. 2

mmjzzfzflaobfl [fishshefzajzefzi] [shlmfnlzolzi] mshalwjzslsfl Lzlwhslzs] W51] CYLINDER NUMBER FIG. 3

TRACK NUMBER 0 01 b u N FIG.4

July 10, 1973 B. T. BENNETT ETAL 1912,008

METHOD FOR REORDERING THE RECORDS OF A FILE Filed Dec. 26, 1972 6 Sheets-Sheet 2 FIG. 5

KEY VALUE STRINGS FIG. 6

KEY VALUE REORDERED FILE 11 12 15 m 2u B21 B22 B2 -1 FIG 7 5u-1 3u 31 July 10, 1973 B. T. BENNETT ETAL T912,008

METHOD FOR REORDERING THE RECORDS OF A FILE Filed Dec. 26, 1972 6 Sheets-Sheet .'T

FlG. 9 LOAD MAIN sTORE AREA WITH G ITEMS FROM x10 PR|QR ART THE INPUT sEOuEMcE. N0 ITEMS ARE MARKED.

T 12 ARE ALL ITEMS MARKED? YES 14 7N0 22 TEST FOR END EMO sTRTMO. uMM RK MARKED 0F INPUT SEQUENCE? ITEMs. sTART NEXT STRING. 16 N0 YES I COMPARE ITEM FROM INPUT SEOUENCEWITH THE SMALLEST ,5 UNMARKED ITEM IN HAINSTORE. APPEND UNMARKED ITEMS /25 IS TMETMPOT I EM LARGER? W MAIN STORE T0 N0 V YES OORREMT STRING IN ORDER MARKTME INPUT ITEM 20 sORT MARKED TTEMs IN MAIN STORE AMO OuTPuT AS FINAL APPEND TME SMALLEST UNMARKED ITEM STRING m MAIN sTORE TO cuRREMT OUTPUT STRING; REPLACE IT IN MAIN sTORE BY THE INPUT ITEM. END

Fl GAO July 10, 1973, a. T. BENNETT ETAL T9l2,00 8

METHOD FOR REORDERING THE RECORDS OF A FILE Filed Dec 26, 1972 6 Sheets-Shae}. 4

CYLINDER NUMBER FIG." 2 3 I TRACK NUMBER I 2 3 4 5 6 7 8 9 10 II. I2 I3 I4=ADDRESS INPUT THE FIRST ITEM FROM EACH STRING TO BE MERGED.

I Fl SELECT THE SMALLEST ITEM. OUTPUT IT AND REILACE/ PRIOR ART IT IF POSSIBLE WITH THE NEXT OCCURRING ITEM ON" THE SAME STRING ANY ITEMS LEFT TO BE MERGED NO YES END July 10, 1973 B. T. BENNETT ETAL T912303 METHOD FOR REORDERING THE RECORDS OF A FILE Filed Dec. 26, 1972 6 Sheets-Sheet 5 1 2 3 4 5 s 7 a s 1011 121314=RECORDS'KEYS F1645 23659 11211114 1141510=ADDRESSES STRING 1 STRING 2 FIGJIB6121043118514911312 BUCKET 2 BUCKET 1 

